using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Plugin.QQInfo.Manager;
using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using System;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.Page
{
	public class QQFriendInfoView : BasePage
	{
		private const string TAG = "QQFriendInfoView";
		private string userName;
		private ContactExtInfo info;
		internal Grid LayoutRoot;
		internal StackPanel ContentPanel;
		internal Grid QQArea;
		internal Image QQImg;
		internal ScrollTextBlock QQNickNameTxt;
		internal TextBlock QQNumTxt;
		internal StackPanel SexPanel;
		internal TextBlock SexTxt;
		internal StackPanel AgePanel;
		internal TextBlock AgeTxt;
		internal StackPanel BirthAreaPanel;
		internal TextBlock BirthTxt;
		internal StackPanel AddressAreaPanel;
		internal EmojiTextEx AddressTxt;
		internal Grid panelAblum;
		private bool _contentLoaded;
		public QQFriendInfoView()
		{
			this.InitializeComponent();
		}
		protected override void OnPageIn(object[] object_0)
		{
			Log.smethod_5("QQFriendInfoView", "OnPageIn start");
			if (object_0 != null && Enumerable.Count<object>(object_0) != 0)
			{
				this.userName = (object_0[0] as string);
				Contact contact = StorageMgr.contact.method_0(this.userName);
				if (contact != null)
				{
					this.QQImg.set_Source(HeadImgMgr.getHeadImage(this.userName, true));
					this.QQNickNameTxt.Text = ContactHelper.getDisplayName(this.userName, null);
					this.QQNumTxt.set_Text(this.userName.Substring(0, this.userName.get_Length() - 5));
					this.info = new ContactExtInfo();
					BatchGetContactProfileMgr.getExtInfo(contact.strExtInfo, ref this.info);
					if (this.info.int_1 == 1)
					{
						this.SexTxt.set_Text(strings.Set_Person_Male);
					}
					else
					{
						this.SexTxt.set_Text(strings.Set_Person_Female);
					}
					this.AgeTxt.set_Text(this.info.int_0.ToString());
					this.BirthTxt.set_Text(this.info.birthday);
					this.AddressTxt.Text = ToolFunction.GetRegionShow(this.info.province, this.info.city);
					return;
				}
				uint nQQ = uint.Parse(this.userName.Substring(0, this.userName.get_Length() - 5));
				QFriend qFriend = QFriendMgr.getQFriend(nQQ);
				if (qFriend == null)
				{
					this.QQImg.set_Source(HeadImgMgr.getHeadImage(this.userName, true));
					this.QQNickNameTxt.Text = nQQ.ToString();
					this.QQNumTxt.set_Text(nQQ.ToString());
					return;
				}
				this.QQImg.set_Source(HeadImgMgr.getHeadImage(qFriend));
				this.QQNickNameTxt.Text = QFriendMgr.getDisplayName(qFriend);
				this.QQNumTxt.set_Text(qFriend.nQQ.ToString());
			}
		}
		protected override void OnPageOut()
		{
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/QQOfflineMsg/UI/QQFriendInfoView.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.ContentPanel = (StackPanel)base.FindName("ContentPanel");
			this.QQArea = (Grid)base.FindName("QQArea");
			this.QQImg = (Image)base.FindName("QQImg");
			this.QQNickNameTxt = (ScrollTextBlock)base.FindName("QQNickNameTxt");
			this.QQNumTxt = (TextBlock)base.FindName("QQNumTxt");
			this.SexPanel = (StackPanel)base.FindName("SexPanel");
			this.SexTxt = (TextBlock)base.FindName("SexTxt");
			this.AgePanel = (StackPanel)base.FindName("AgePanel");
			this.AgeTxt = (TextBlock)base.FindName("AgeTxt");
			this.BirthAreaPanel = (StackPanel)base.FindName("BirthAreaPanel");
			this.BirthTxt = (TextBlock)base.FindName("BirthTxt");
			this.AddressAreaPanel = (StackPanel)base.FindName("AddressAreaPanel");
			this.AddressTxt = (EmojiTextEx)base.FindName("AddressTxt");
			this.panelAblum = (Grid)base.FindName("panelAblum");
		}
	}
}
